//
/******************************************************
        File name:    main.c
        Author:       Bitat (陆叁柒)
        Gitee :       https://gitee.com/bitat
        Email :       737166381@qq.com
        History:      2023/1/6
*******************************************************/


#include <stdio.h>
int main()
{
    int i = 0;
    int a = 0;
    int b = 0;
    int max = 0;
    int min = 100;
    scanf("%d",&a);
    for(i=0; i<a; i++)
    {
        scanf("%d",&b);
        if(b>max)
        {
            max = b;
        }
        if(b<min)
        {
            min = b;
        }
    }
    printf("%d\n",max-min);
    
    return 0;
}
